<template>
  <div class="orderInfo">
     <div class="cart" >
      <div class="cart-headline"></div>
      <div class="cart-info">
      <div class="info-name">
        <span>{{address.name}}</span>
        <span>默认</span>
      </div>
      <div class="contact">
        <div class="c-phone">{{address.mobile}}</div>
        <div class="c-addr">{{address.address + address.address_detail}}</div>
      </div>
      <div class="sysbol" @click="goAddrMannager">
      </div>
      </div>
    </div>


    <div class="params">
      <div class="total">
        <span>商品合计</span>
        <span>￥{{allPrice}}</span>
      </div>
      <div class="express">
        <span>运费</span>
        <span>免运费</span>
      </div>
      <div class="coupon">
        <span>优惠劵</span>
        <span>暂无</span>
      </div>
    </div>

    <div class="goodsList">
      <div class="item" v-for="(item,index) in goodsList" :key="index">
        <div class="goodsInfo">
          <img :src="item.pic_list_url" alt="">
          <div class="">
            <span>{{item.name}}</span>
            <span>￥{{item.retail_price}}</span>
          </div>
        </div>
        <div class="quantity">
          x{{item.skunum}}
        </div>        
      </div>

    </div>
  
  </div>
</template>

<script>
export default {
  data(){
    return{
      openId : '',
      addressId : '',
      goodsList:[],
      address:{},
      allPrice:0
    }
  },
  mounted(){
    this.openId = this.$api.getOpenId()
    this.addressId = this.$api.getWxaddress()
    this.getinitial()
  },
  methods:{
    async getinitial(){
      let result = await this.$api.order.reqInspect({
        openId:this.openId,
        addressId:this.addressId
      })
      if(result.status === 200){
        let {shopCart,seAddr,totalPrice} = result
        this.goodsList = shopCart
        this.address = seAddr
        this.allPrice = totalPrice
      }
    },

    goAddrMannager(){
      wx.navigateTo({ url: '/pages/addrManager/main' });
    }
    
  }

}
</script>

<style lang="less" scoped>
@import './index.less';
</style>